﻿@model AppInfoModel
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN VALIDATION STATES-->
        <div class="portlet box green">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-reorder"></i>@ViewBag.TableTitle
                </div>
                <div class="tools">
                </div>
            </div>
            <div class="portlet-body form">
                <!-- BEGIN FORM-->
                <form action="@Url.Action("Edit")" i id="appcreate" class="form-horizontal" method="post" novalidate="novalidate" enctype="multipart/form-data">
                    <div class="form-body">

                        @*总的错误提示*@
                        <div class="alert alert-danger display-hide">
                            <button class="close" data-close="alert"></button>
                            You have some form errors. Please check below.
                        </div>
                        <div class="alert alert-success display-hide">
                            <button class="close" data-close="alert"></button>
                            Your form validation is successful!
                        </div>

                        @*如果錯誤信息不為空返回錯誤信息*@
                        @{ var error = Html.ValidationSummary(); }
                        @if (ViewBag.HasModelError != null && ViewBag.HasModelError)
                        {
                            <div class="alert alert-danger id=errorSummary">
                                <button class="close" data-close="alert"></button>
                                @error
                            </div>
                            @section ModelStateScript{
                                <script>
                                    $(function () {
                                        var errorSummary = $('#errorSummary');
                                        App.scrollTo(errorSummary, -200);
                                    })
                                </script>
                            }                        }

                        @Html.AntiForgeryToken()
                        @Html.HiddenFor(s => s.Id)

                        <div class="form-group">
                            <label class="control-label col-md-3">
                                Identity(用于显示在url中)
                                <span class="required">
                                    *
                                </span>
                            </label>
                            <div class="col-md-4">
                                <input type="text" name="Identity" data-required="1" class="form-control" value="@(Model?.Identity)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">
                                Name
                                <span class="required">
                                    *
                                </span>
                            </label>
                            <div class="col-md-4">
                                <input type="text" name="Name" data-required="1" class="form-control" value="@(Model?.Name)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-3">密碼&nbsp;&nbsp;</label>
                            <div class="col-md-4">
                                <input name="PassWord" type="text" class="form-control" value="@(Model?.PassWord)">
                            </div>
                        </div>

                        <div class="form-group last">
                            <label class="control-label col-md-3">AppLogo 上传</label>
                            <div class="col-md-9">
                                <div class="fileupload fileupload-new" data-provides="fileupload">
                                    <div class="fileupload-new thumbnail" style="height: 150px; width: 200px;">
                                        <img src="@GetImage(Model?.AppLogo)" alt="">
                                    </div>
                                    <div class="fileupload-preview fileupload-exists thumbnail" style="line-height: 20px; max-height: 150px; max-width: 200px;">
                                    </div>
                                    <div>
                                        <span class="btn default btn-file">
                                            <span class="fileupload-new">
                                                <i class="fa fa-paper-clip"></i> Select image
                                            </span>
                                            <span class="fileupload-exists">
                                                <i class="fa fa-undo"></i> Change
                                            </span>
                                            <input type="file" class="default" name="AppLogoFile">
                                        </span>
                                        <a href="#" class="btn red fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash-o"></i> Remove</a>
                                    </div>
                                </div>
                                <span class="label label-danger">
                                    NOTE!
                                </span>
                                <span>
                                    Attached image thumbnail is supported in Latest Firefox, Chrome, Opera, Safari and Internet Explorer 10 only
                                </span>
                            </div>
                        </div>

                        <div class="portlet-body">
                            <ul class="nav nav-tabs">
                                <li class="active">
                                    <a href="#tab_1_1" data-toggle="tab">Android</a>
                                </li>
                                <li class="">
                                    <a href="#tab_1_2" data-toggle="tab">Ios</a>
                                </li>
                            </ul>
                            <div class="tab-content">
                                <div class="tab-pane fade active in" id="tab_1_1">
                                    @Html.Partial("_AndroidCreate", Model)
                                </div>
                                <div class="tab-pane fade" id="tab_1_2">
                                    @Html.Partial("_IosCreate", Model)
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-actions fluid">
                        <div class="col-md-offset-3 col-md-9">
                            <button type="submit" class="btn green">Submit</button>
                            <button type="button" class="btn default">Cancel</button>
                        </div>
                    </div>
                </form>
                <!-- END FORM-->
            </div>
            <!-- END VALIDATION STATES-->
        </div>
    </div>
</div>
@section script{
    <script src="~/assets/zrjs/app/edit.js"></script>
    <script>

        //$(function () {
        //    editors.push('AndroidDescription');
        //    editors.push('IosDescription');
        //    editors.push('AndroidUpdatedExplain');
        //    editors.push('IosUpdatedExplain');

        //    FormValidation.init();
        //    FormComponents.init();
        //})
    </script>
}